<h1 class="title">Plan du site</h1>
<?php
$menu = new ioMenu();
$countMenuList = count($menu_list);
if(!empty($menu_list) && $countMenuList > 0 )
{
    $tabMenu = array();
    foreach($menu_list as $key => $cat) {
        if(!isset($menu[$cat[ 'title' ]]) && empty($cat[ 'category_parent_id' ])) {
            $menu->addChild($cat[ 'title' ], (url_for('@homepage') . $sf_user->getCulture() . $cat[ 'link' ]), array('class' => 'menu_level_0'));
            $tabMenu[] = array( "id" => $cat[ 'id' ], "title" => $cat[ 'title' ]);
        }
    }

    foreach($menu_list as $key => $cat) {
        foreach($tabMenu as $key_parent => $cat_parent) {
            if($cat[ 'category_parent_id' ] == $cat_parent["id"]) {

                $link = url_for('@homepage') . $sf_user->getCulture() . $cat[ 'link' ];
//                foreach($pages_list as $page){
//                    if($page[ 'category_id' ] == $cat["id"]){
//                        $link = url_for('@page?title_slug=' . $page[ 'slug' ]);
//                    }
//                }


                $menu[$cat_parent["title"]]->addChild( '&#187; ' . $cat[ 'title' ], $link, array('class' => 'menu_level_1'));
            }
        }
    }
}
echo $menu->render();
?>